package cn.liontalk.config.database;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ZhouZhe
 * @version 1.0
 * @description
 * @date 2018-12-11 21:19
 **/
@Configuration
@AutoConfigureAfter(MybatisDataSourceConfig.class)
public class MybatisMapperScanerConfig {

    // MybatisDataSourceConfig.java 类加载完之后,再去加载 MybatisMapperScanerConfig
    // @AutoConfigureAfter

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer(){
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
        mapperScannerConfigurer.setBasePackage("cn.liontalk.dao");
        return mapperScannerConfigurer;
    }

}
